﻿using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Web.UI;
using System.Threading;

namespace CodeCounsel.DialogsDemo.Layouts.CodeCounsel.DialogsDemo
{
    public partial class DialogPage : Page
    {
        protected override void OnInit(EventArgs e)
        {
            ((DialogMaster)this.Page.Master).OkButton.Click += OkButton_Click;
            base.OnInit(e);
        }

        void OkButton_Click(object sender, EventArgs e)
        {
            using (SPLongOperation operation = new SPLongOperation(this))
            {
                operation.LeadingHTML = "Creating new Navigation Application";
                operation.Begin();
                Thread.Sleep(5000);
                operation.EndScript("window.frameElement.commitPopup();");
            }
        }
    }
}
